import pickle
import os

class Mydes:
    def __init__(self,name):
        self.name = name+'.pkl'
        self.list1=[]

    def __get__(self,instance,name):
        if self.name not in self.list1:
            raise AttributeError("%s 属性还没有赋值！" % self.name)
        else :
            with open(self.name,'rb') as f1:
                val = pickle.load(f1)            
            return val

            
    def __set__(self,instance,value):
        with open(self.name,'wb') as f1:
            pickle.dump(value,f1)
            self.list1.append(self.name)
            
    def __delete__(self,name):
        os.remove(self.name)
        self.list1.remove(self.name)
        
        
        
class Test:
    x=Mydes('x')
    y=Mydes('y')
    c=Mydes('c')
    


test=Test()
test.x=123
test.y='12'
